import 'dart:math';
import 'package:dio/dio.dart';
import 'package:wallpaper/http/dio_instance.dart';

Future<Response> mohuImgsApi({required String id, int num = 50}) =>
    DioInstance.instance().get(path: 'https://img.moehu.org/pic.php', param: {
      'id': id,
      'return': 'json',
      'size': 'mw690',
      'num': num,
      'radom': Random().nextDouble(),
    });

//     export const getSearchImgs = (params: any): any => request({
//     url: isDev === true ? '/apihzBase/api/img/apihzimgbaidu.php' : 'https://cn.apihz.cn/api/img/apihzimgbaidu.php',
//     method: 'GET',
//     params
// })

Future<Response> getSearchImgs({String keyword = ''}) => DioInstance.instance()
        .get(path: 'https://cn.apihz.cn/api/img/apihzimgbaidu.php', param: {
      'keyword': keyword,
    });

Future<Response> getPixiv({String tag = '', var r18 = 0}) =>
    DioInstance.instance()
        .post(path: 'https://setu.yuban10703.xyz/setu', data: {
      'num': 30,
      'r18': r18,
      'replace_url': "https://i.pixiv.re",
      'tags': [tag],
      'radom': Random().nextDouble(),
    });

Future<Response> getPixiv2({String tag = '', var r18 = 0}) =>
    DioInstance.instance().post(path: 'https://api.lolicon.app/setu/v2', data: {
      'num': 20,
      'r18': r18,
      'tag': [tag],
      'size': ['original', 'small'],
      'radom': Random().nextDouble(),
    });

Future<Response> randomVideo() => DioInstance.instance()
    .get(path: 'https://api.kxzjoker.cn/API/Beautyvideo.php?type=json');

Future<Response> getMoeImgs({required String sort, int number = 50}) =>
    DioInstance.instance().get(path: 'https://imgapi.lie.moe/random', param: {
      'sort': sort,
      'type': 'json',
      'num': number,
      'thumbnail': 'large',
      'radom': Random().nextDouble(),
    });
